from Page.Page import Page
import time
from selenium.webdriver.common.by import By

class Page2(Page):
    # 积分商城 /html/body/div[3]/div[2]/ul/li[6]/a
    shop_loc = (By.XPATH,'/html/body/div[3]/div[2]/ul/li[6]/a')
    def shop(self):
        self.click(self.shop_loc)

    # 图片 /html/body/div[5]/div[2]/div[2]/div[1]/ul/li[2]/div[1]/span/a/img
    goods_loc = (By.XPATH,'/html/body/div[5]/div[2]/div[2]/div[1]/ul/li[2]/div[1]/span/a/img')
    def goods(self):
        self.click(self.goods_loc)

    # 立即兑换 id="buy-cart"
    buy_loc = (By.ID,'buy-cart')
    def buy(self):
        self.click(self.buy_loc)

    # 选择地址 id="address-39"
    address_loc = (By.ID,'address-39')
    def address(self):
        self.click(self.address_loc)

    # 下一步 id="order-button"
    next_loc = (By.ID,'order-button')
    def next(self):
        self.click(self.next_loc)

    # dy4 您的订单支付成功 /html/body/div[4]/div[3]/span
    dy4_loc = (By.XPATH,'/html/body/div[4]/div[3]/span')
    def dy4(self):
        return self.text(self.dy4_loc)

    def luoji_02(self):
        self.shop()
        time.sleep(2)
        self.goods()
        self.buy()
        time.sleep(2)
        self.address()
        self.next()
        time.sleep(2)
        print(self.dy4())